// store/actions.js
import { parseCsv } from './utils.js'; // 假设我们有一个 utils 文件来处理 CSV 解析

export default {
  async loadDefaultWordList({ commit }) {
    try {
      const response = await fetch('path/to/default.csv');
      const text = await response.text();
      const wordList = parseCsv(text);
      commit('setWordList', wordList);
    } catch (error) {
      console.error('加载默认单词表失败:', error);
    }
  },
  changeWordList({ commit }, { fileName, wordList }) {
    commit('setWordList', wordList);
    commit('setWordListFileName', fileName);
  }
};
